package org.springblade.modules.monitor.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.node.INode;
import org.springblade.modules.monitor.pojo.CommonNameAndCount;
import org.springblade.modules.monitor.pojo.LinkRelationshipVO;
import org.springblade.modules.monitor.pojo.SystemCountAndStatusVO;
import org.springblade.modules.monitor.service.FirstPageService;
import org.springblade.modules.system.entity.Dict;
import org.springblade.modules.system.wrapper.DictWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@AllArgsConstructor
@RequestMapping("/blade-monitor/firstpage")
@Api(value = "大屏", tags = "大屏接口")
public class FirstPageController {

	private FirstPageService firstPageService;

	@GetMapping("/tabOverview")
	@ApiOperationSupport(order = 1)
	@ApiOperation(value = "网络设备、服务器、应用等总览", notes = "网络设备、服务器、应用等总览")
	public R<List<CommonNameAndCount>> getTabOverview() {
		List<CommonNameAndCount> tabOverview = firstPageService.getTabOverview();
		return R.data(tabOverview);
	}


	@GetMapping("/exceptionOverview")
	@ApiOperationSupport(order = 1)
	@ApiOperation(value = "异常总览", notes = "获取异常总览")
	public R<List<CommonNameAndCount>> getExceptionOverview() {
		List<CommonNameAndCount> exceptionOverview = firstPageService.getExceptionOverview();
		return R.data(exceptionOverview);
	}


	@GetMapping("/serverOverview")
	@ApiOperationSupport(order = 1)
	@ApiOperation(value = "服务器总览", notes = "获取服务器总览")
	public R<List<CommonNameAndCount>> getServerOverview() {
		List<CommonNameAndCount> serverOverview = firstPageService.getServerOverview();
		return R.data(serverOverview);
	}

	@GetMapping("/networkEquipOverview")
	@ApiOperationSupport(order = 1)
	@ApiOperation(value = "网络设备总览", notes = "获取网络设备总览")
	public R<List<CommonNameAndCount>> getNetworkEquipOverview() {
		List<CommonNameAndCount> networkEquipOverview = firstPageService.getNetworkEquipOverview();
		return R.data(networkEquipOverview);
	}

	@GetMapping("/systemCountAndStatusOverview")
	@ApiOperationSupport(order = 1)
	@ApiOperation(value = "获取所有设备状态统计", notes = "服务器、网络设备等可用、不可用、健康、亚健康等")
	public R<List<SystemCountAndStatusVO>> getSystemCountAndStatusOverview() {
		List<SystemCountAndStatusVO> systemCountAndStatusOverview = firstPageService.getSystemCountAndStatusOverview();
		return R.data(systemCountAndStatusOverview);
	}



	@GetMapping("/linkRelationship")
	@ApiOperationSupport(order = 1)
	@ApiOperation(value = "设备拓扑图", notes = "设备拓扑图")
	public R<LinkRelationshipVO> linkRelationship() {
		LinkRelationshipVO linkRelationship = firstPageService.getLinkRelationship();
		return R.data(linkRelationship);
	}

}
